using UnityEngine;
using System.Collections;

public class _Balas : MonoBehaviour {
	
	float speed;
	
	public float Value;
	public Vector2 size;
	public Texture texture;
	Vector2 realS ;
	
	void Start () 
	{
		gameObject.AddComponent("MeshRenderer");
		gameObject.AddComponent("MeshFilter");
	
		realS = new Vector2(size.x * Menu.ns.x , size.y * Menu.ns.y);
		this.gameObject.transform.position = new Vector3 (this.gameObject.transform.position.x * Menu.ns.x , this.gameObject.transform.position.y * Menu.ns.y , 0);
		
		Mesh mesh = Quad.Create(realS.x,realS.y);
		gameObject.GetComponent<MeshFilter>().mesh = mesh;
		gameObject.GetComponent<MeshRenderer>().material = (Material) Resources.Load("Outros/Transparent");
		gameObject.GetComponent<MeshRenderer>().material.mainTexture = (Texture) Resources.Load("Texturas/I_B");
	
		
	}
	
	void Update()
	{
		speed = Value * Time.deltaTime * Menu.ns.x;
		transform.Translate(-speed , 0 , 0);
	}
		
	void OnCollisionEnter (Collision c)
	{
		if(c.gameObject.CompareTag("Player"))
		{
			_Player.f_coins += 1;
			Destroy(gameObject);
		}
	}
}
